package com.kaizeli.website.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kaizeli.website.pojo.entity.Invoice;
import com.kaizeli.website.pojo.dto.InvoiceDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 开票单Mapper接口
 */
@Mapper
public interface InvoiceMapper extends BaseMapper<Invoice> {

    /**
     * 根据验收单ID查询开票单列表
     */
    List<InvoiceDTO> selectByAcceptanceId(@Param("acceptanceId") Integer acceptanceId);

    /**
     * 根据项目ID查询开票单列表
     */
    List<InvoiceDTO> selectByProjectId(@Param("projectId") Long projectId);

    /**
     * 根据开票状态查询开票单列表
     */
    List<InvoiceDTO> selectByInvoiceStatus(@Param("invoiceStatus") String invoiceStatus);

    /**
     * 计算项目总开票金额
     */
    BigDecimal calculateTotalInvoiceAmount(@Param("projectId") Long projectId);

    /**
     * 更新开票状态
     */
    int updateInvoiceStatus(@Param("id") Integer id, @Param("invoiceStatus") String invoiceStatus);
}
